// 东莞专属功能
export default class {
  constructor(send2Ue, listen2Ue) {
    this.send2Ue = send2Ue;
    this.listen2Ue = listen2Ue;
    this.baseCmd = "/BP_BuildGrowth";
  }
  active(cb) {
    this.send2Ue(`${this.baseCmd}/EnableBuildingGrowth`, {}, cb);
  }
  cancel(cb) {
    this.send2Ue(`${this.baseCmd}/DisableBuildingGrowth`, {}, cb);
  }
  play(cb) {
    this.send2Ue(`${this.baseCmd}/Play`, {});
    this.listen2Ue(`${this.baseCmd}/FinishGrowth_CallBack`, cb);
  }
  pause(cb) {
    this.send2Ue(`${this.baseCmd}/Pause`, {}, cb);
  }
  continue(cb) {
    this.send2Ue(`${this.baseCmd}/Continue`, {}, cb);
  }
  /**
   * @description: 设置播放模型生长速度
   * @param {float} data
   * @param {function} cb
   * @return {*}
   */
  setSpeed(data, cb) {
    this.send2Ue(
      `${this.baseCmd}/SetSpeed`,
      {
        Speed: parseFloat(data),
      },
      cb
    );
  }
  /**
   * @description: 设置特定生长节点
   * @param {float} data
   * @param {function} cb
   * @return {*}
   */
  setNode(data, cb) {
    this.send2Ue(
      `${this.baseCmd}/SetSpecialTime`,
      {
        SpecialTime: parseFloat(data),
      },
      cb
    );
  }
  /**
   * @description: 返回节点数据，字段名称为：NodeTime，格式为：int
   * @param {*} cb
   * @return {*}
   */
  getNode(cb) {
    this.listen2Ue(`${this.baseCmd}/NodeTime_CallBack`, cb);
  }
}
